$(document).ready(function () {

    //加载应用宝典首页一级九宫格
    $.post("../Index/checkOneItem",null, function (response) {
        var testJson = eval(response);
        $("#1").html("");
        if (testJson.length>1) {
            for (var i = 0; i < testJson.length; i++) {
                if ((i + 1) % 3 == 0) {
                    $("#1").append(
                        '<li>' +
                        '<button type="button" one_id="' + testJson[i]["ONE_ID"] + '"  title="' + testJson[i]["ONE_NAME"] + '">' +
                        '<img alt="" src="../Content/Images/logo/' + testJson[i]["ONE_IMG"] + '" /></button>' +
                        '<span>' + testJson[i]["ONE_NAME"] + '</span>' +
                        '</li>' +
                        '<div class="clearfix"></div>'
                    );
                } else {
                    $("#1").append(
                        '<li>' +
                        '<button type="button" one_id="' + testJson[i]["ONE_ID"] + '"  title="' + testJson[i]["ONE_NAME"] + '">' +
                        '<img alt="" src="../Content/Images/logo/' + testJson[i]["ONE_IMG"] + '" /></button>' +
                        '<span>' + testJson[i]["ONE_NAME"] + '</span>' +
                        '</li>'
                    );
                }
            }
        }else {
            alert(testJson[0]["failInfo"]);
        }
        $("button[one_id]").click(function () {
            var one_id=$(this).attr("one_id");
            if(one_id=='1')//危化品
            {
                location.href = "../page/twoindex?one_id=" + $(this).attr("one_id")+"&title="+$(this).attr("title");

            }else if(one_id=='6')//办案指南
            {
                location.href ="http://xwservice.njga.gov.cn/xwzf/";

            }else if (one_id=='7')//模板
            {
                location.href ="../page/allModel?one_id=" + $(this).attr("one_id")+"&title="+$(this).attr("title");

            }else if (one_id=='8')//法律法规
            {
                location.href ="http://w.lawstar.cn/weixin/searchIndex.jsp?from=groupmessage&isappinstalled=0";
            }else {
                alert("正在建设中");
            }
        });
    });


});